package com.jlu.main;

import com.jlu.iml.FileIOHandlerImpl;
import com.jlu.iml.FileQueryImpl;
import com.jlu.iml.HeartBeatHandlerImpl;
import com.jlu.mcloud.communicate.fileio.FileIoHandler;
import com.jlu.mcloud.communicate.heartbeat.HeartbeatHandler;
import com.jlu.mcloud.rpc.server.ServiceCenter;
import com.jlu.p2pserver.IFileQuery;
import com.jlu.utils.Const;

import java.io.IOException;

/**
 * @Author freedom
 * @DATE 2017/5/16 0016 21:41.
 * see   主程序入口
 */
public class ServerMain {

    public static void main(String[] args) {
        try {
            ServiceCenter server = ServiceCenter.getInstance(Const.PORT);
            server.register(HeartbeatHandler.class, HeartBeatHandlerImpl.class);
            server.register(FileIoHandler.class, FileIOHandlerImpl.class);
            server.register(IFileQuery.class,FileQueryImpl.class);
            server.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
